<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        let json = '{"type": "新品推荐","infor": [{"id": 1,"cookId": 1,"name": "蓝莓泡泡表白水","url": "/images/0/1.jpg","price": 8,"temp": ["正常冰"],"sugar": ["正常糖", "少糖"],"quantity": 0},{"id": 2,"cookId": 2,"name": "蜜桃泡泡表白水","url": "/images/0/2.jpg","price": 8,"temp": ["正常冰"],"sugar": ["正常糖", "少糖"],"quantity": 0}]}';
        let o = JSON.parse(json);

        let js = {"type": "新品推荐","infor": [{"id": 1,"cookId": 1,"name": "蓝莓泡泡表白水","url": "/images/0/1.jpg","price": 8,"temp": ["正常冰"],"sugar": ["正常糖", "少糖"],"quantity": 0},{"id": 2,"cookId": 2,"name": "蜜桃泡泡表白水","url": "/images/0/2.jpg","price": 8,"temp": ["正常冰"],"sugar": ["正常糖", "少糖"],"quantity": 0}]};
        let str = JSON.stringify(js);
        for (let i = 0; i < 2; i++){
            console.log(o.infor[i].name);
            console.log(typeof str);
            console.log(typeof js);
        }
    </script>
</body>

</html>